package com.hxx.widget.richtext.editor

import android.text.Editable
import android.text.Layout
import android.text.Selection
import android.text.style.StyleSpan
import com.hxx.widget.richtext.toolbar.RichTextStyleMenu

class UpdateSelectionsSpan(val editable: Editable) : RichTextStyleMenu.StyleListener {
    private val laterUpdateSpans = arrayListOf<Any>()
    private fun isRangSelection(): Boolean {
        return Selection.getSelectionStart(editable) != Selection.getSelectionEnd(editable)
    }

    override fun onBoldChanged(enable: Boolean) {
        if (isRangSelection()) {
            //直接更新
        } else {
            //加入待更新样式集合中
            var replaceSpan: StyleSpan? = null
            laterUpdateSpans.forEach {
                if (it is StyleSpan){

                }
            }
        }
    }

    override fun onItalicChanged(enable: Boolean) {
        TODO("Not yet implemented")
    }

    override fun onUnderlineChanged(enable: Boolean) {
        TODO("Not yet implemented")
    }

    override fun onStrikeThroughChanged(enable: Boolean) {
        TODO("Not yet implemented")
    }

    override fun onListOrderChanged(enable: Boolean) {
        TODO("Not yet implemented")
    }

    override fun onAlignmentChanged(alignment: Layout.Alignment) {
        TODO("Not yet implemented")
    }

    override fun onColorChanged(color: Int) {
        TODO("Not yet implemented")
    }

    override fun onFontSizeChanged(scale: Float) {
        TODO("Not yet implemented")
    }

}